import Vue from 'vue'
import VueRouter from 'vue-router';

import Login from "@/components/Login";
import Register from "@/components/Register";
import Home from "@/components/Home";
import ll from "@/components/ll";
import UserInfo from "@/components/user/UserInfo";
import UserPassword from "@/components/user/UserPassword";
import info from "@/components/hospital/info";
import List from "@/components/hospital/List";
import Check from "@/components/hospital/Check";
import UserManage from "@/components/user/UserManage";
import Upload1 from "@/components/upload/Upload1";
import Upload2 from "@/components/upload/Upload2";
import Upload3 from "@/components/upload/Upload3";
import Upload4 from "@/components/upload/Upload4";
import UploadRecord from "@/components/upload/UploadRecord";
import Received_information from "@/components/message/Received_information";
import MessageManage from "@/components/message/MessageManage";
import DataAnalysis from "@/components/analysis/DataAnalysis";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/register',
        component: Register
    },
    {
        path: '/home',
        component: Home,
        redirect: "/home/dataAnalysis",
        children: [
            {
                path: 'll',
                component: ll
            },
            {
                path: 'userinfo',
                component: UserInfo
            },
            {
                path: 'userpassword',
                component: UserPassword
            },
            {
                path: "info",
                component: info
            },
            {
                path: "list",
                component: List
            },
            {
                path: "check",
                component: Check
            },
            {
                path: "usermanage",
                component: UserManage
            },
            {
                path: "upload1",
                component: Upload1
            },
            {
                path: "upload2",
                component: Upload2
            },
            {
                path: "upload3",
                component: Upload3
            },
            {
                path: "upload4",
                component: Upload4
            },
            {
                path: "uploadRecord",
                component: UploadRecord
            },
            {
                path: "received",
                component: Received_information
            },
            {
                path: "messageManage",
                component: MessageManage
            },
            {
                path: "dataAnalysis",
                component: DataAnalysis
            }
        ]
    },
]

const router = new VueRouter({
    mode: 'history',
    routes
})

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
    return VueRouterPush.call(this, to).catch(err => err)
}

export default router;